<input hidden="hidden" id="navValue" value="部门分类">

<div class="page-content">
    <div class="page-header">
        <h1>
            部门管理
            <small>
                <i class="ace-icon fa fa-angle-double-right"></i>
                部门分类
            </small>

            <label style="margin-left: 50px;">
                <button type="button" class="btn btn-purple btn-sm" onclick="location='{:url("department/category")}'">
                    <span class="ace-icon fa fa-plus-circle icon-on-right bigger-110"></span>
                    添加分类
                </button>
            </label>

        </h1>
    </div><!-- /.page-header -->

            <div class="row">
                <div class="col-xs-12">
                    <table id="simple-table" class="table  table-bordered table-hover">
                        <thead>
                        <tr>
                            <th class="center">
                                <label class="pos-rel">
                                    <input type="checkbox" class="ace">
                                    <span class="lbl"></span>
                                </label>
                            </th>
                            <th class="detail-col center">ID</th>
                            <th class="center">分类名称</th>
                            <th class="center">提成</th>
                            <th class="center" style="width: 30%">成员组成</th>
                            <th class="center">状态</th>
                            <th class="center">操作</th>
                        </tr>
                        </thead>

                        <tbody>
                        {foreach $list as $val}
                        <tr  class="center">
                            <td>
                                <label class="pos-rel">
                                    <input type="checkbox" class="ace">
                                    <span class="lbl"></span>
                                </label>
                            </td>
                            <td>{$val['id']}</td>
                            <td>{$val['name']}</td>
                            <td>{$val['per']}%</td>
                            <td>{$val['needValue']}</td>
                            <td>{$val['statusValue']}</td>
                            <td>
                                <div class="hidden-sm hidden-xs btn-group">

                                    <button class="btn btn-xs btn-info" onclick="location='{:url("department/catedetail","id=".$val->id)}'">
                                        <i class="ace-icon fa fa-pencil bigger-120"></i>
                                    </button>

                                    <button class="btn btn-xs btn-danger"  onclick="cateDelete({$val->id});">
                                        <i class="ace-icon fa fa-trash-o bigger-120"></i>
                                    </button>
                                </div>

                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div><!-- /.span -->
            </div><!-- /.row -->

            <div class="hr hr-18 dotted hr-double"></div>
            <!-- PAGE CONTENT ENDS -->
        </div><!-- /.col -->
    </div><!-- /.row -->
</div>
<script type="text/javascript">
    function cateDelete(id){
        $.ajax({
           url:"{:url('department/cateDelete')}",
            data:{id:id},
            type:'get',
            dataType: "json",
            success: function(data){
                console.log(data);
                if(data == 'success'){
                    layer.msg('删除成功');
                    location.reload();
                }else{
                    layer.msg('删除失败');
                }
            }
        });
    }
</script>